const review = require('../service/review')

const getReviewList = async(ctx)=>{
    let res = await review.getReviewList(ctx.query)
    return ctx.body={
        code:20000,
        data:res,
        msg:'获取成功'
    }
}

const addReview = async(ctx)=>{
    let res = await review.addReview(ctx.request.body)
    return ctx.body={
        code:20000,
        data:res,
        msg:'评论成功'
    }
}

const getClassify = async(ctx)=>{
    let res = await review.getClassify(ctx.query)
    return ctx.body={
        code:20000,
        data:res,
        msg:'获取成功'
    }
}

// 获取锦旗分类
const getBanner = async(ctx)=>{
    let res = await review.getBanner(ctx.query)
    if(res.length > 0){
        return ctx.body={
            code:20000,
            data:res,
            msg:'获取成功'
        }
    }
}

// 获取锦旗评论
const getBanview = async(ctx)=>{
    let res = await review.getBanview(ctx.query)
        return ctx.body={
            code:20000,
            data:res,
            msg:'获取成功'
        }
}

// 新增锦旗
const giveBanner = async(ctx)=>{
    let res = await review.giveBanner(ctx.request.body)
    return ctx.body={
        code:20000,
        data:res,
        msg:'评论成功'
    }
}

// 获取视频
const getVidou = async(ctx)=>{
    let res = await review.getVidou(ctx.query)
    return ctx.body={
        code:20000,
        data:res,
        msg:'获取成功'
    }
}

module.exports = {
    getReviewList,
    addReview,
     giveBanner,
    getBanview,
    getBanner,
    getClassify,
    getVidou
}